package Servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class BServlet extends HttpServlet {

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws  IOException {
		// TODO 自动生成的方法存根
		req.setCharacterEncoding("utf-8");
		resp.setContentType("text/html;charset=utf-8");
		PrintWriter out = resp.getWriter();
		String user=req.getParameter("user");
		String pass = req.getParameter("pwd");
		if(user.equals("admin")&&pass.equals("admin")){
			out.println("Welcome to Jay's Page ! ! ! ");
		}else{
			out.println("<script language='javascript'>alert('Your  input is incorrect ! !')</script>");
			out.println("<script language='javascript'>window.location.href='/myfirst_web/test2.html'</script>");
		}
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		// TODO 自动生成的方法存根
		doGet(req, resp);
	}
}